package com.laboratory.serviceprovide;

import com.Laboratory.workBench.pojo.notice;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import org.junit.jupiter.api.Test;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author acok
 * @description:TODO
 * @Date 2022/12/15 15:32
 * @Version 1.0
 */
public class test01 {
    @Test
    public void test001(){
        List<notice> list=new ArrayList<>();
        list.add(new notice("111","111","111","111"));
        list.add(new notice("222","111","111","111"));
        list.add(new notice("333","111","111","111"));
        list.add(new notice("444","111","111","111"));
        list.add(new notice("555","111","111","111"));
        System.out.println(list.toString());
        //list转json字符串
        String noticesJson=JSON.toJSONString(list);
        System.out.println(noticesJson);
        //将json字符串转换为list集合
        List<notice> newList=JSON.parseObject(noticesJson,new TypeReference<List<notice>>(){});
        System.out.println(newList.toString());
    }
}
